package org.coderk.mybatis.controller;

import org.coderk.mybatis.service.MybatisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: TanJingyu
 * @create: 2021-03-23 22:50
 **/
@RestController
@RequestMapping("/mybatis")
public class MybatisController {
    private final JdbcTemplate jdbcTemplate;
    private final MybatisService mybatisService;

    public MybatisController(JdbcTemplate jdbcTemplate, MybatisService mybatisService) {
        this.jdbcTemplate = jdbcTemplate;
        this.mybatisService = mybatisService;
    }

    @GetMapping
    public String string() {


//        Map result = jdbcTemplate.queryForMap("select * from user where id = 1");
//        System.out.println(result);
//        jdbcTemplate.update("update user set name = '王吉' where id = 1");


//        mybatisService.string();

        return "success...";
    }
}
